草庐IT

javascript ondrop 事件

全部标签

c# - 如何动态地在 xamarin 表单中的标签上创建点击事件

我正在开发跨平台xamarin应用程序,我想为“忘记密码?”创建超链接标签。在登录页面上。我使用以下代码创建标签,但我不知道如何在其上创建onclick事件。MainPage=newContentPage{BackgroundImage="background.png",Content=newStackLayout{VerticalOptions=LayoutOptions.CenterAndExpand,HorizontalOptions=LayoutOptions.CenterAndExpand,Spacing=50,Children={newLabel{HorizontalTex

c# - WPF:在 ListView 中添加项目时引发事件

我在WPF上工作,我正在使用ListView,我需要在向其中添加项目时触发一个事件。我试过这个:vardependencyPropertyDescriptor=DependencyPropertyDescriptor.FromProperty(ItemsControl.ItemsSourceProperty,typeof(ListView));if(dependencyPropertyDescriptor!=null){dependencyPropertyDescriptor.AddValueChanged(this,ItemsSourcePropertyChangedCallback

c# - QueueUserWorkItem() 和 BeginInvoke() 之间的区别是什么,用于执行不需要返回类型的异步事件

根据我的BeginInvoke()/EndInvoke()问题,Delegate.BeginInvoke()和使用QueueUserWorkItem()异步调用委托(delegate)之间在性能/其他方面是否存在重大差异? 最佳答案 我能想到的关于QueueUserWorkItem的主要事情是你必须使用WaitCallback委托(delegate)类型,如果你已经有一个SomeRandomDelegate实例和一些参数。好消息是你可以用闭包来解决这个问题:ThreadPool.QueueUserWorkItem(delegate{

c# - 如何处理以编程方式添加的按钮事件? C#

我正在使用C#制作Windows窗体应用程序。我在运行时以编程方式添加按钮和其他控件。我想知道如何处理这些按钮的点击事件? 最佳答案 尝试以下操作Buttonb1=CreateMyButton();b1.Click+=newEventHandler(this.MyButtonHandler);...voidMyButtonHandler(objectsender,EventArgse){...} 关于c#-如何处理以编程方式添加的按钮事件?C#,我们在StackOverflow上找到一个

c# - 如何在 WPF 中使用 Application.Exit 事件?

我需要删除某些文件,然后用户关闭了WPF中的程序。所以我从这里尝试了MDSN代码http://msdn.microsoft.com/en-us/library/system.windows.application.exit.aspx这样:此代码位于App.xml.cspublicpartialclassApp:Application{voidApp_Exit(objectsender,ExitEventArgse){MessageBox.Show("Filedeleted");varsystemPath=System.Environment.GetFolderPath(Environm

c# - 将参数传递给事件处理程序

这个问题在这里已经有了答案:Passextraparameterstoaneventhandler?(10个答案)关闭9年前。我想通过我的List作为参数使用我的事件publiceventEventHandler_newFileEventHandler;List_filesList=newList();publicvoidstartListener(stringdirectoryPath){FileSystemWatcherwatcher=newFileSystemWatcher(directoryPath);_filesList=newList();_timer=newSystem.

c# - 如何将变量传递给按钮事件方法?

我需要能够将两个对象传递给单击按钮时触发的方法。我该怎么做?到目前为止,我一直在考虑创建一个更改的EventArgs:publicclassCompArgs:System.EventArgs{privateobjectmetode;privateTypetypen;publicCompArgs(objectm,Typet){this.metode=m;this.typen=t;}publicobjectMetode(){returnmetode;}publicTypeTypen(){returntypen;}}但是我该如何使用它呢?是否有可能以某种方式覆盖按钮的点击事件以使用自定义ev

c# - 如何删除 'Click' 的 'Button' 事件的所有事件处理程序?

我有一个按钮控件,我需要删除所有附加到其Clickevent的事件处理程序.这怎么可能?Buttonbutton=GetButton();button.Click.RemoveAllEventHandlers(); 最佳答案 Note:SincethequestiononwhichIpostedmyoriginalanswerwasclosedasaduplicateofthisquestion,I'mcross-postinganimprovedversionofmyanswerhere.Thisansweronlyapplies

c# - 当数据源为 Linq 时访问 ItemDataBound 事件中的列

我使用以下代码设置数据源:protectedvoidPage_Load(objectsender,EventArgse){varvacancies=fromvindb.Vacanciesjoincindb.Customersonv.CustomerIDequalsc.CustomerIDjoincpindb.CustomerPortalsonc.CustomerIDequalscp.CustomerIDwherecp.PortalID==Master.Portal.IDselectnew{Title=v.Title,Internship=(v.ContractID==6),Hours=

c# - Windows.Form 不触发 keyDown 事件

privatevoidscreensaverWindow_Load(objectsender,System.EventArgse){this.BringToFront();this.Focus();this.KeyPreview=true;this.KeyDown+=newKeyEventHandler(onkeyDown);}onKeyDown()永远不会被调用。知道为什么吗?编辑:这适用于Release模式!?我猜一定是visualstudio调试器在某处干扰了 最佳答案 这是由于窗体上的子控件拦截事件造成的。如果这是不可取的,